var e = getApp(), t = require("B7F487A3A71FB5DFD192EFA4970CA4D1.js").BASE_URL, o = {
    filterError: function(e) {
        var t = "";
        switch (e) {
          case 400:
            t = "错误的请求";
            break;

          case 403:
            t = "禁止访问";
            break;

          case 404:
            t = "所请求的资源不存在";
            break;

          case 405:
            t = "不被允许的方法";
            break;

          case 422:
            t = "表单提交验证失败";
            break;

          case 429:
            t = "请求过多";
            break;

          case 500:
            t = "内部服务器错误";
            break;

          case 502:
            t = "服务器无响应";
            break;

          case 504:
            t = "网关超时";
            break;

          default:
            t = "未知错误,value：" + e;
        }
        return t;
    },
    netSuccess: function() {
        var s = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
        "function" == typeof s.config.success && s.config.success(s.res), 200 === s.res.statusCode ? (s.res.data && "string" == typeof s.res.data && (s.res.data = JSON.parse(s.res.data)), 
        s.res.data && (401 === s.res.data.code ? (e.loseSession(), require("0BACB9C3A71FB5DF6DCAD1C4BE4CA4D1.js").login(function(e) {
            1001 === e ? "function" == typeof s.request && s.request(s.method, s.url, s.data, s.config) : "function" == typeof s.config.fail && s.config.fail({
                errMsg: "登录授权失败"
            });
        })) : 1001 !== s.res.data.code && setTimeout(function() {
            wx.showToast({
                title: s.res.data.msg,
                icon: "none",
                duration: 2e3
            });
        }, 10))) : 401 === s.res.statusCode ? (e.loseSession(), require("0BACB9C3A71FB5DF6DCAD1C4BE4CA4D1.js").login(function(e) {
            1001 === e ? "upload" === s.type && "function" == typeof s.upload ? s.upload(s.url, s.filePath, s.formData, s.config) : "function" == typeof s.request && s.request(s.method, s.url, s.data, s.config) : "function" == typeof s.config.fail && s.config.fail({
                errMsg: "登录授权失败"
            });
        })) : setTimeout(function() {
            wx.showToast({
                title: o.filterError(s.res.statusCode),
                icon: "none",
                duration: 2e3
            });
        }, 10), "https://test.api.whosssmade.com" === t && (200 !== s.res.statusCode || s.res.data && 1001 !== s.res.data.code) && console.log(s.res);
    },
    netFail: function(e, o, s) {
        "function" == typeof s.fail && s.fail(e), "request:fail" === e.errMsg && setTimeout(function() {
            wx.showToast({
                title: "请求超时或无网络，请稍后重试",
                icon: "none",
                duration: 2e3
            });
        }, 10), "https://test.api.whosssmade.com" === t && (console.error("------------utils/http.js--------------"), 
        console.error(e));
    }
};

module.exports = o;